package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.SaleOrderBean;
import com.project.mapper.ISaleOrderInfoMapper;
import com.project.mapper.ISaleOrderMapper;
import com.project.service.ISaleOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class SaleOrderInfoServiceImpl implements ISaleOrderInfoService {

    @Autowired
    private ISaleOrderInfoMapper saleOrderInfoMapper;

    @Override
    public IPage<SaleOrderBean> findByItem(Integer pageNO, String clientName, LocalDate startDate, LocalDate endDate) {
        return saleOrderInfoMapper.findByItem(new Page<>(pageNO, 3), clientName, startDate, endDate);
    }

    @Override
    public SaleOrderBean findByOrderId(Integer saleOrderId) {
        return saleOrderInfoMapper.findByOrderId(saleOrderId);
    }
}
